package it.orma.iridehr.jobs;

import java.io.IOException;
import java.util.Map;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;
 
public class EmailJob extends QuartzJobBean {
	private EmailTask emailTask;
 
	public void setEmailTask(EmailTask runMeTask) {
		this.emailTask = runMeTask;
	}
 
	protected void executeInternal(JobExecutionContext context)
		throws JobExecutionException {
		final Map<String,Object> jobDataMap = context.getMergedJobDataMap();
		if(jobDataMap!=null&&jobDataMap.get("messageWindow")!=null){
			emailTask.setMessageWindow((Integer) jobDataMap.get("messageWindow"));
		}
		emailTask.fetchNewEMail();
 
	}
}
